package saig;

import java.io.ByteArrayOutputStream;

import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import saig.engine.Settings;
import saig.engine.graphics.VisualRunner;

/**
 * The starting point for the application.
 * @author Adam
 * @version $Id$
 * 
 * Created on May 27, 2010 at 9:07:13 PM
 */
public class App {
	/**
	 * Logger.
	 */
	private final static Logger LOGGER = LoggerFactory.getLogger(VisualRunner.class);
	/**
	 * Runs the game in visual mode.
	 * @param args The arguments (settings) to the game.
	 */
    public static void main(final String[] args ) {
    	Settings settings = new Settings();
		CmdLineParser parser = new CmdLineParser(settings);
    	try {
    	    parser.parseArgument(args);
    	} catch(CmdLineException e) {
    		ByteArrayOutputStream outStream = new ByteArrayOutputStream();
     	    parser.printUsage(outStream);
    		LOGGER.error(outStream.toString(), e);
    	    return;
    	}
    	new VisualRunner(settings);
    }
}
